use std::fmt::Debug;
use std::sync::mpsc;
use std::thread;

#[test]
fn test_channel(){
    let (sender,receiver) = mpsc::channel::<i32>();

    thread::spawn( move || {
        for i in 1..100 {
            if sender.send(i).is_err(){
                break;
            }
        }
    });

    thread::spawn( move || {
        let result = receiver.recv();
        print!("result.unwrap {}",result.unwrap())
    });

    print!("result.unwrap {}","finished")
}

